#include <bits/stdc++.h>
using namespace std;

// Check if the charactor is a number or an operator.
const char D[18] = "0123456789.+-*/()";
inline bool check(const char & c) {
	for (int i = 0; i < 17; ++i) if(c == D[i]) return 1;
	return 0;
}
inline bool isop(const char & c){
	for (int i = 11; i < 17; ++i) if(c == D[i]) return 1;
	return 0;
}

string s;			// Initial input.
string a;			// Only retain the numbers and operators.
stack <double> num;	// Number stack.
stack <char> oper;	// Operator stack.

// The priority of operators
inline int level(char c) {
	switch (c) {
		case '+': return 1;
		case '-': return 1;
		case '*': return 2;
		case '/': return 2;
		case '(': return 0;
		case '[': return 0;
	}
}

// curnum: the current number.
// power: power of the current digit.
double curnum, power;
// isminus: whether the number is minus.
// decimal: whether in the decimal part.
bool isminus, decimal;

inline void init(){
	a = "";
	while (!num.empty()) num.pop();
	while (!oper.empty()) oper.pop();
	curnum = 0, power = 1;
	isminus = decimal = 0;
}

// Push a number onto the stack.
inline void push_num() {
	if (isminus) curnum = -curnum;
	num.push(curnum);
	curnum = 0, power = 1;
	isminus = decimal = 0;
}

// Pop a operator together with to numbers from the stack.
inline void pop_oper() {
	double num1, num2, res;
	num2 = num.top(), num.pop();
	num1 = num.top(), num.pop();
	switch (oper.top()){
		case '+': res = num1 + num2; break;
		case '-': res = num1 - num2; break;
		case '*': res = num1 * num2; break;
		case '/': res = num1 / num2; break;
	}
	num.push(res), oper.pop();
}

double calc(string s){
	init();
	// Filter.
	for (int i = 0; i < s.length(); ++i)
		if(check(s[i])) a += s[i];
	if (!a.length()) return 0;
	for (int i = 0; i < a.length(); ++i) {
		char ch = a[i];
		// Numbers
		if(ch >= '0' && ch <= '9') {
            if (i && a[i-1] == ')') throw -2;
			if (decimal) power *= 0.1, curnum += (ch - '0') * power;
			else curnum = curnum * 10 + (ch - '0');
			if (i+1 == a.length() || isop(a[i+1])) push_num();
		}
		else if(ch == '.') {
			if (decimal) throw -1;
			else decimal = 1;
			if (i+1 == a.length() || isop(a[i+1])) throw -2;
		}
		// Operators
		else{
			// Left brackets
			if (ch == '(') {
				// "3(" is illegal.
				if (i && !isop(a[i-1]) || a[i-1] == ')') throw -2;
				// Push "[" as "-(".
				if (isminus) oper.push('['), isminus = 0;
				else oper.push('(');
			}
			else if (ch == ')') {
				// "+)" is illegal.
				if (!i || isop(a[i-1]) && a[i-1] != ')') throw -2;
				// Calculate the expression between "()"
				while (!oper.empty() && level(oper.top())) pop_oper();
				// "(" is not found.
				if (oper.empty()) throw -3;
				if (oper.top() == '[') num.top() = -num.top();
				oper.pop();
			}
			else{
				if(i+1 == a.length()) throw -2;
				if (!i || isop(a[i-1]) && a[i-1] !=')') {
					// "+*" is illegal.
					if (ch != '-') throw -2;
					// But "3+-2" "4*-3" is legal.
					else {
						if (!isminus) isminus = 1;
						else throw -2;
					}
					continue;
				}
				// Calculate the expression whose priority is higher than the current operator.
				while (!oper.empty() && level(oper.top()) >= level(ch)) pop_oper();
				oper.push(ch);
			}
		}
	}
	// Calculate the rest expression.
	while (!oper.empty() && level(oper.top())) pop_oper();
	// "1+(((" is illegal.
	if (!oper.empty()) throw -3;
	return num.top();
}

int main() {
	double res;
	while(getline(cin, s)){
		try{
			res = calc(s);
			cout << res << endl;
		}
		catch (int code) {
			cout << "Error! Code: " << code << endl;
		}
	}
}